package cn.yunhe.crm.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yunhe.crm.dao.TasklistMapper;
import cn.yunhe.crm.entity.Tasklist;

@Service("TasklistService")
public class TasklistService {
		
	@Autowired
	private TasklistMapper tMapper;

	public void settMapper(TasklistMapper tMapper) {
		this.tMapper = tMapper;
	}
	// 新增任务
	public void saveTask(Tasklist tasklist) {
		tMapper.saveTask(tasklist);
	}

	// 根据 id 查询任务
	public Tasklist findTaskById(Integer id) {
		Tasklist tasklist = tMapper.findTaskById(id);
		return tasklist;
	}

	// 查询全部任务
	public List<Tasklist> findAllTask() {
		return tMapper.findAllTask();
	}
	/**
	 * 查询机构总数
	 * @return
	 */
	public int checkCount(){
		return tMapper.countByExample(null);
	}
	/**
	 * 根据时间查询机构总数
	 * @param begintime
	 * @param endtime
	 * @return
	 */
	public int checkCountByYearAndMonth(String begintime,String endtime){
		Map map=new HashMap();
		map.put("begintime", begintime);
		map.put("endtime", endtime);
		return tMapper.checkCountByYearAndMonth(map);
	}
public int checkCountByToday(){
		
		return tMapper.checkCountByToday();
	}
}
